package com.luoqian.demo03;

/**
 *  通过局部反射破坏单例模式
 */
public class Reflection_destruction_Singleton {
    public static void main(String[] args) throws Exception {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        Singleton s3 = Singleton.getInstance();

        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);

        //reflection
        Singleton singleton = Singleton.class.getConstructor().newInstance();
        System.out.println(singleton);
    }
}
